package com.nlp.visualization.pojo.bayes;

import com.hankcs.hanlp.classification.tokenizers.HanLPTokenizer;
import com.hankcs.hanlp.classification.tokenizers.ITokenizer;
import com.hankcs.hanlp.collection.trie.bintrie.BinTrie;

import java.util.HashMap;
import java.util.Map;

/**
 * @author LXM
 * @Title: NLPVisualizationTools
 * @Description:
 * @date 2018/5/9下午5:10
 */
public class BayesModel {

    /**
     * 先验概率的对数值 log( P(c) )
     */
    public Map<Integer, Double> logPriors = new HashMap<Integer, Double>();

    /**
     * 似然对数值 log( P(x|c) )
     */
    public Map<Integer, Map<Integer, Double>> logLikelihoods = new HashMap<Integer, Map<Integer, Double>>();

    /**
     * 训练样本数
     */
    public int n = 0;
    /**
     * 类别数
     */
    public int c = 0;
    /**
     * 特征数
     */
    public int d = 0;

    /**
     * 类目表
     */
    public String[] catalog;
    /**
     * 分词器
     */
    public HanLPTokenizer tokenizer;
    /**
     * 词语到的映射
     */
    public BinTrie<Integer> wordIdTrie;


    public BayesModel() {
    }

    public BayesModel(Map<Integer, Double> logPriors, Map<Integer, Map<Integer, Double>> logLikelihoods, int n, int c, int d, String[] catalog, HanLPTokenizer tokenizer, BinTrie<Integer> wordIdTrie) {
        this.logPriors = logPriors;
        this.logLikelihoods = logLikelihoods;
        this.n = n;
        this.c = c;
        this.d = d;
        this.catalog = catalog;
        this.tokenizer = tokenizer;
        this.wordIdTrie = wordIdTrie;
    }
}
